import request from '@/utils/request';

/**
 * 已激活企业列表
 */
export async function getCorpList(page, companyName, notApplyDay, pageLimit) {
    return await request.post('/api/1.0/govercompany/company/list', {
        pageCurrent: page,
        companyHsName: companyName,
        notApplyDay: notApplyDay,
        pageLimit: pageLimit
    });
}

/**
 * 已激活企业列表--导出
 */
export async function EgetCorpList(page, companyName, notApplyDay,pageLimit) {
    return await request.post('/api/1.0/govercompany/company/list', {
        pageCurrent: page,
        companyHsName: companyName,
        notApplyDay: notApplyDay,
        pageLimit: pageLimit
    });
}

/**
 * 未激活企业列表
 */
export async function getCorpListN(page, companyName, pageLimit) {
    return await request.post(
        '/api/1.0/base/m812011companyinfowmzx/custom/list',
        {
            pageCurrent: page,
            companyName: companyName,
            eb4: 1,
            pageLimit: pageLimit
        }
    );
}

/**
 * 未激活企业列表--导出
 */
export async function EgetCorpListN(page, companyName,pageLimit) {
    return await request.post(
        '/api/1.0/base/m812011companyinfowmzx/custom/list',
        {
            pageCurrent: page,
            companyName: companyName,
            eb4: 1,
            pageLimit: pageLimit
        }
    );
}

//提交注册用户
export async function register(
    hsCode,
    hsName,
    address,
    contact,
    name,
    phone,
    checked
) {
    return await request.post('/api/1.0/govercompany/company/append', {
        companyHsCode: hsCode,
        companyName: hsName,
        address: address,
        phone: contact,
        responPerson: name,
        responPersonPhone: phone,
        isMessage: checked
    });
}

export let resetPassWord = async (companyId) => {
    return await request.post('/api/1.0/manager/user/reset/password/bycompanyid', {companyId});

}

export let delData = async (id) => {
    return request.post('/api/1.0/base/m812011companyinfowmzx/discard', {
        token: localStorage.getItem('token'),
        id
    })
}

/**
 * 催报 --需要企业id和短信模板
 * @param companyIds
 * @param msgModel
 * @returns {Promise<*>}
 * @constructor
 */
export let Report = async (companyIds, msgModel) => {
    return request.post('/api/1.0/govercompany/rush/company/byids', {
        token: localStorage.getItem('token'),
        companyIds,
        msgModel
    })
}

/**
 * 一键催报
 * @param companyIds
 * @param msgModel
 * @returns {Promise<*>}
 * @constructor
 */
export let OneReport = async (notApplyDay, msgModel) => {
    return request.post('/api/1.0/govercompany/rush/company/all', {
        token: localStorage.getItem('token'),
        notApplyDay,
        msgModel
    })
}
/**
 * 已激活企业列表--停用
 * @param id
 * @returns {Promise<*>}
 */
export let companyAStopUse = async (id,meno) => {
    return request.post('/api/1.0/govercompany/active/company/stop', {
        token: localStorage.getItem('token'), id,meno
    })
}

/**
 * 未激活企业列表--停用
 * @param id
 * @returns {Promise<*>}
 */
export let companyStopUse = async (id,delFlag,meno) => {
    return request.post('/api/1.0/base/m812011companyinfowmzx/custom/modify',
        {
            token: localStorage.getItem('token'),
            id,delFlag,meno
        })
}

/**
 * 企业停用列表
 * @param id
 * @returns {Promise<*>}
 */
export let stopCompanyList = async (pageCurrent,companyName) => {
    return request.post('/api/1.0/base/m812011companyinfowmzx/custom/list',
        {
            pageCurrent,companyName,
            token: localStorage.getItem('token'),
            delFlag:1
        })
}


/**
 * 企业重新启用
 * @param id
 * @returns {Promise<*>}
 */
export let reUserFn = async (id) => {
    return request.post('/api/1.0/govercompany/stop/company/active',
        {
            id,
            token: localStorage.getItem('token')

        })
}
